﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NhWeather.Register
{
    class TimeRegister : InputRegister
    {
        /// <summary>
        /// 生成时间数据
        /// </summary>
        public override void Generate()
        {
            var now = DateTime.Now;
            switch (RegAddress)
            {
                case 0:
                    Data = (short)(((now.Year - 2000) << 8) | (now.Month & 0x00FF));
                    break;
                case 1:
                    Data = (short)((now.Day << 8) | (now.Hour & 0x00FF));
                    break;
                case 2:
                    Data = (short)((now.Minute << 8) | (now.Second & 0x00FF));
                    break;
            }
        }
    }
}
